package g14.sc12project.milestone1;

import java.util.ArrayList;
import java.util.List;

import g14.sc12project.milestone1.BookStore.AuthorsInfo;
import g14.sc12project.milestone1.BookStore.BookCategory;
import g14.sc12project.milestone1.BookStore.BookInfo;


import g14.sc12project.milestone1.Common.Constants;

public class BootStraper {
	
	public static void main(String[] args){
		
		/*
		List<String> books = getAllBooKNames();
		
		System.out.println("----------- All Books -----------");
		for(int count=0; count<books.size();count++){
			System.out.println(books.get(count));
		}
		
		books = getAllBookISBN10();
		
		System.out.println("\n----------- All Books ISBN10 -----------");
		for(int count=0; count<books.size();count++){
			System.out.println(books.get(count));
		}
		
		books = getAllBookISBN13();
		
		System.out.println("\n----------- All Books ISBN13 -----------");
		for(int count=0; count<books.size();count++){
			System.out.println(books.get(count));
		}
		
		List<BookInfo> bookList = getBooksByTitle("SE #1");
		System.out.println("\n----------- All Books by Title -----------");
		for(int count=0; count<bookList.size();count++){
			BookInfo book=bookList.get(count);
			System.out.println(book.getTitle());
			AuthorsInfo auth = book.getAuthors();
			ArrayList<String> authList = auth.getAuthorlist();
			System.out.println("^^^^Authors^^^^^");
			for(int i=0; i<authList.size(); i++){
				System.out.println(authList.get(i));
			}
			
		}
		
		bookList = getBooksByAuthor("Mohammad");
		System.out.println("\n----------- All Books by Author -----------");
		for(int count=0; count<bookList.size();count++){
			BookInfo book=bookList.get(count);
			System.out.println(book.getTitle());
			AuthorsInfo auth = book.getAuthors();
			ArrayList<String> authList = auth.getAuthorlist();
			System.out.println("^^^^Authors^^^^^");
			for(int i=0; i<authList.size(); i++){
				System.out.println(authList.get(i));
			}
			
		}
		/*
		BookInfo bookInfo = getBookInfobyISBN10("ISBN 101");
		System.out.println("\n----------- All Books by ISBN10 -----------");
		
		System.out.println(bookInfo.getTitle());
		AuthorsInfo auth = bookInfo.getAuthors();
		ArrayList<String> authList = auth.getAuthorlist();
		System.out.println("^^^^Authors^^^^^");
		for(int i=0; i<authList.size(); i++){
			System.out.println(authList.get(i));
		}
		
		bookInfo = getBookInfobyISBN13("ISBN131");
		System.out.println("\n----------- All Books by ISBN13 -----------");
		
		System.out.println(bookInfo.getTitle());
		auth = bookInfo.getAuthors();
		authList = auth.getAuthorlist();
		System.out.println("^^^^Authors^^^^^");
		for(int i=0; i<authList.size(); i++){
			System.out.println(authList.get(i));
		}
			
		*/
	}

	public static List<String> getAllBooKNames(){
		BookCategory bc=new BookCategory(Constants.BOOK_STORE_DB_FILE);
		return bc.getAllBooKNames();
	}
	
	public static List<String> getAllBookISBN10(){
		BookCategory bc=new BookCategory(Constants.BOOK_STORE_DB_FILE);
		return bc.getAllBookISBN10();
	}
	
	public static List<String> getAllBookISBN13(){
		BookCategory bc=new BookCategory(Constants.BOOK_STORE_DB_FILE);
		return bc.getAllBookISBN13();
	}
	
	public static List<BookInfo> getBooksByTitle(String title){
		BookCategory bc=new BookCategory(Constants.BOOK_STORE_DB_FILE);
		return bc.getBooksByTitle(title);
	}
	
	public static List<BookInfo> getBooksByAuthor(String author){
		BookCategory bc=new BookCategory(Constants.BOOK_STORE_DB_FILE);
		return bc.getBooksByAuthor(author);
	}
	
	public static BookInfo getBookInfobyISBN10(String isbn10){
		BookCategory bc=new BookCategory(Constants.BOOK_STORE_DB_FILE);
		return bc.getBookInfobyISBN10(isbn10);
	}
	
	public static BookInfo getBookInfobyISBN13(String isbn13){
		BookCategory bc=new BookCategory(Constants.BOOK_STORE_DB_FILE);
		return bc.getBookInfobyISBN13(isbn13);
	}

}
